// 签名
import _bale from '../utils/package.js'
// 获取不同的接口地址
import { SSO_API, SHARE_API, USER_API, COMMON_API, INDEXS_API } from '../config/index.js'
import { Service } from '../utils/server.js'
class MineModel extends Service {
  //获取用户个人信息
  getUserInfo(params) {
    return this.postRequest(SSO_API + '/vipUser/get_info', {
      data: _bale('get_info', params)
    })
  }

  //获取用户目前账户的总金币数和金币记录
  getUserGold(params) {
    return this.postRequest(SHARE_API + '/red/goldList', {
      data: _bale('/red/goldList', params)
    })
  }

  //签到
  Sign(params) {
    return this.postRequest(SHARE_API + '/task/sign', {
      data: _bale('sign', params)
    })
  }
  // 新增会员地址
  addAddress(params) {
    return this.postRequest(USER_API + '/address/addAddress', {
      data: _bale('addAddress', params)
    })
  }
  // 编辑地址
  editAddress(params) {
    return this.postRequest(USER_API + '/address/editAddress', {
      data: _bale('editAddress', params)
    })
  }

  // 查看会员所有地址列表
  getAddressList(params) {
    return this.postRequest(USER_API + '/address/queryAddress', {
      data: _bale('queryAddress', params)
    })
  }
  // 会员地址删除
  delAddress(params) {
    return this.postRequest(USER_API + '/address/delAddress', {
      data: _bale('queryAddress', params)
    })
  }
  // 默认地址设置
  setDefaultAddress(params) {
    return this.postRequest(USER_API + '/address/defaultAddress', {
      data: _bale('defaultAddress', params)
    })
  }
  // 请求地址详情
  getAddressDetail(params) {
    return this.postRequest(USER_API + '/address/lookAddress', {
      data: _bale('lookAddress', params)
    })
  }

  //查询规则协议
  queryrule(params) {
    return this.postRequest(COMMON_API + '/ruleCommon/queryrule', {
      data: _bale('queryrule', params)
    })
  }

  // 绑定手机号
  wx_bind_phone(params) {
    return this.postRequest(USER_API + '/vipManage/wx_bind_phone', {
      data: _bale('wx_bind_phone', params)
    })
  }

  // 获取门禁二维码值
  getDoorKey(params) {
    return this.postRequest(INDEXS_API + '/common/getDoorKey', {
      data: _bale('getDoorKey', params)
    })
  }

  // 小程序查询微信绑定信息
  getBandWxInfo(params) {
    return this.postRequest(USER_API + '/vipManage/getBandWxInfo', {
      data: _bale('getBandWxInfo', params)
    })
  }

  // 更新小程序微信绑定信息
  updateBandWxInfo(params) {
    return this.postRequest(USER_API + '/vipManage/updateBandWxInfo', {
      data: _bale('updateBandWxInfo', params)
    })
  }
}

export { MineModel }
